package web.handler

import manager.WaresManager
import org.json.JSONObject
import web.request.jsonOf

class OnGetInvHandler(json: JSONObject) : AbstractHandler(json, REQ) {

    companion object {

        const val REQ = "get"

        const val FIELD_INV = "inventory"
    }

    override fun exec(): JSONObject {
        val json = jsonOf(MSG_OK, CODE_OK)
        json.put(FIELD_INV, WaresManager.toJson())
        return json
    }
}